home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir24 / aprs501a.zip / MAPCNVRT.BAS < prev    next >
BASIC Source File  |  1994-05-11  |  3KB  |  77 lines

  1. REM this program takes a map file and then can output another map file
  2. REM to a different pixels-per-degree scale and different origin.
  3. REM This is useful for combining maps to make big ones, or taking roads from
  4. REM big ones and adding them to small ones...
  5.  
  6. OPTION BASE 0
  7. CLS : PRINT "This program will convert any APRS map from one ORIGIN and SCALE"
  8.       PRINT "to another.  The output of this program will be in MAPTEMP.map"
  9.       PRINT
  10. Prompt: INPUT "Enter File name of source map"; F$
  11.         IF INSTR(F$, ".") = 0 THEN F$ = F$ + ".map"
  12.  
  13.         OPEN F$ FOR INPUT AS #3
  14.         INPUT "Enter desired SCALE in pixels-per-deg"; PPDD
  15.         INPUT "Enter New Latitude of origin"; NLat
  16.         INPUT "Enter New Longitude of origin"; NLon
  17.  
  18.  
  19.      INPUT "Enter file name for output if other than MAPTEMP.MAP"; F$
  20.      IF F$ = "" THEN F$ = "MAPTEMP.MAP"
  21.      OPEN F$ FOR OUTPUT AS #4
  22.      INPUT #3, LATa: LINE INPUT #3, a$: IF NLat = 0 THEN NLat = LATa
  23.      PRINT #4, NLat; ","; a$
  24.      INPUT #3, LONa: LINE INPUT #3, a$: IF NLon = 0 THEN NLon = LONa
  25.      PRINT #4, NLon; ","; a$
  26.      INPUT #3, ppdV: LINE INPUT #3, a$'Pix-per-deg-Vert
  27.      PRINT #4, PPDD; ","; a$
  28.      INPUT #3, LatCen: LINE INPUT #3, a$
  29.      PRINT #4, LatCen; ","; a$
  30.      INPUT #3, LonCen: LINE INPUT #3, a$
  31.      PRINT #4, LonCen; ","; a$
  32.      INPUT #3, MapRng: LINE INPUT #3, a$
  33.      PRINT #4, MapRng; ","; a$
  34.      INPUT #3, MinRnga: LINE INPUT #3, a$
  35.      PRINT #4, MinRnga; ","; a$
  36.      LINE INPUT #3, a$: REM ignore line of instructions
  37.      PRINT #4, a$
  38.      i = 0
  39.      REM now make offset and scale calculations
  40.      Sfac = PPDD / ppdV
  41.      LOfset = LONa - NLon
  42.      LAfset = LATa - NLat
  43. ON ERROR GOTO Errorfix
  44.  
  45.      PRINT : PRINT "Now processing map points.  Should an end of file error occur"
  46.      PRINT "use F6, then CLOSE, to close the file.  Then use your editor to see"
  47.      PRINT "what you have so far and fix any errors..."
  48.  
  49.      DO WHILE NOT EOF(3)
  50.         i = i + 1: INPUT #3, x%, y%
  51.         IF x% <> 0 THEN
  52.            x% = Sfac * (x% - ppdV * LOfset)
  53.            y% = Sfac * (y% - ppdV * LAfset)
  54.            IF x% = 0 THEN x% = 1: PRINT "ZERO value of X!  Converted to 1,"; y%
  55.            END IF
  56.         REM print #4, MID$(STR$(x%), 2); ","; MID$(STR$(y%), 2)
  57.         WRITE #4, x%, y%
  58.         IF x% = 0 AND NOT EOF(3) THEN ' Get line color & store with x=0
  59.            INPUT #3, z%: LINE INPUT #3, a$ ' Echo line name
  60.            PRINT #4, z%; ","; a$
  61.            IF y% = -1 THEN EXIT DO' All labels listed at end of file
  62.            END IF
  63.         LOOP: PRINT
  64.         PRINT "All map points converted.  Now doing labels..."
  65.         DO WHILE NOT EOF(3)
  66.         LINE INPUT #3, a$: PRINT #4, a$
  67.         LOOP: CLOSE #3: CLOSE #4
  68.        
  69.         PRINT : PRINT "CONVERSION SUCCESSFUL. USE EDITOR TO ADD ANY NEW FEATURES"
  70.         PRINT "TO YOUR NEW MAP IN FILE NAMED MAPTEMP.map."
  71.         INPUT "Hit return to continue.."; a$: STOP
  72.  
  73. Errorfix: IF ERR = 62 THEN CLOSE : RESUME NEXT
  74.  
  75. END
  76.  
  77.